#include "file_util.h"
#include <fstream>

namespace krryn{
namespace core{

std::vector<char> read_file(const std::string &a_Filename){
	std::fstream file(a_Filename.c_str());
	return read_stream(file);
}

std::vector<char> read_stream(std::istream &a_Stream){
	std::vector<char> buffer;

	// determine a_Stream size
	a_Stream.seekg(0,std::ios::end);
	std::istream::pos_type length = a_Stream.tellg();
    a_Stream.seekg(0,std::ios::beg);

	buffer.resize(length);
    a_Stream.read(&buffer[0], length);

	return buffer;
}

}
}